package at.jku.ssw.fortress.ui;

import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.Bundle;

public class IdeUtilities {

	public static ImageDescriptor getImageDescriptor(String path) {
		return AbstractUIPlugin.imageDescriptorFromPlugin(FortressPlugin.PLUGIN_ID, path);
	}

	public static void logError(String message, Throwable ex) {
		IStatus status = new Status(IStatus.ERROR, FortressPlugin.PLUGIN_ID, 0, message, ex);
		Bundle bundle = Platform.getBundle(FortressPlugin.PLUGIN_ID);
		Platform.getLog(bundle).log(status);
	}

	public static void logError(IStatus status) {
		Bundle bundle = Platform.getBundle(FortressPlugin.PLUGIN_ID);
		Platform.getLog(bundle).log(status);
	}
}
